/*
 * @Description:
 * @Author: iamsmiling
 * @Date: 2021-05-22 17:05:20
 * @LastEditTime: 2021-06-16 09:33:13
 */
import 'package:credit_business_circle/R/R.dart';
import 'package:credit_business_circle/pages/main_binding.dart';
import 'package:flutter/material.dart';
import 'package:get_storage/get_storage.dart';

import 'pages/main_page.dart';
import 'package:get/get.dart';
import 'package:dokit/dokit.dart';

import 'routes/app_pages.dart';
import 'routes/app_routes.dart';

void main() async {
  ///　初始化 GetStorage
  await GetStorage.init();
  DoKit.runApp(
      app: DoKitApp(MyApp()),
      // 是否在release包内使用，默认release包会禁用
      useInRelease: true,
      releaseAction: () => {
            // release模式下执行该函数，一些用到runZone之类实现的可以放到这里，该值为空则会直接调用系统的runApp(MyApp())，
          });
  // runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return GetMaterialApp(
      initialRoute: AppRoutes.main,
      getPages: AppPages.pages,
      theme: R.theme.lightTheme,
      home: MainPage(),
      initialBinding: MainBinding(),
      defaultTransition: Transition.cupertino,
      popGesture: false,
      navigatorKey: Get.key,
      builder: (BuildContext context, Widget? child) {
        return MediaQuery(
          //Setting font does not change with system font size
          data: MediaQuery.of(context).copyWith(
              // devicePixelRatio: Get.width / Get.height,
              textScaleFactor: GetPlatform.isAndroid ? .88 : 1.0
              // textScaleFactor: 1
              ),
          child: child!,
        );
      },
    );
    // return MaterialApp(
    //   title: 'Flutter Demo',
    //   theme: RTheme.lightTheme,
    //   home: MainPage(),
    //   // home: MyHomePage(title: 'Flutter Demo Home Page'),
    // );
  }
}
